Skip to content

* edit UnityFS BlocksInfo-at-end bundles by appending tail blocks - #198

Open
Hawkynt wants to merge 1 commit into
mainfrom
perf/unityfs-tail-editing-v2
Open

* edit UnityFS BlocksInfo-at-end bundles by appending tail blocks#198
Hawkynt wants to merge 1 commit into
mainfrom
perf/unityfs-tail-editing-v2

Conversation

@Hawkynt

@Hawkynt Hawkynt commented Sep 6, 2026

Copy link
Copy Markdown
Owner

What changed

  • add a changed-byte editor for modern UnityFS bundles with BlocksInfoAtEnd (0x80)
  • pure additions append new independent Stored storage blocks where the old trailing BlocksInfo record began, then regenerate only BlocksInfo and the four mutable size/flag fields in the header
  • existing compressed storage blocks stay opaque and byte-identical; they are neither decompressed nor moved
  • direct removal is allowed when removed non-empty nodes occupy a suffix of whole storage blocks; zero-length nodes are metadata-only removals anywhere
  • same-name replacement, front-loaded BlocksInfo, or removals that share a storage block with surviving nodes reject before the first write and retain the verified rebuild fallback
  • advertise CanModify now that a genuine random-access mutation path exists for the supported profile

Complexity

For BlocksInfoAtEnd layouts:

  • pure add: O(BlocksInfo metadata + added bytes)
  • zero-length remove: O(BlocksInfo metadata)
  • trailing whole-block remove: O(BlocksInfo metadata) plus truncation

Untouched existing storage blocks are never read through the modifier and never rewritten. Front-loaded BlocksInfo remains rebuild-only because growing that metadata shifts the data stream by construction.

Tests

Added descriptor-level I/O-budget coverage using a 4 MiB untouched stored node. A tiny tail add and removal of the final independent block must stay below 128 KiB of archive reads/writes while the 4 MiB block remains at the same physical offset and extracts byte-identically. Zero-length removal is likewise metadata-only, and a shared-block removal is required to fall back rather than corrupt a survivor.

This PR is reconstructed on current main from the previously prepared branch; the two modified pre-existing files were byte-identical upstream, so the resulting diff contains only the intended four UnityFS files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant